
#include "delay.h"
#include "INTRINS.H"


#define CRY12
//define CRY110592
/*
#ifdef CRY12
#endif //CRY12
#ifdef CRY110592
#endif //CRY110592
*/

void __delay1us() {
	#ifdef CRY12
		_nop_();
	#endif //CRY12
		
	#ifdef CRY110592
	#endif //CRY110592
}


void __delay10us()		
{
	unsigned char i;

	#ifdef CRY12
		_nop_();
		i = 2;
		while (--i);
	#endif //CRY12
		
	#ifdef CRY110592
		unsigned char i;

		i = 2;
		while (--i);
	#endif //CRY110592
	
}

void __delay100us()		
{
	unsigned char i;
	
	#ifdef CRY12
	_nop_();
	i = 47;
	while (--i);
	#endif //CRY12
	
	#ifdef CRY110592
	

	_nop_();
	i = 43;
	while (--i);
	#endif //CRY110592
}



void __delay1ms() {
	unsigned char i, j;
	
	#ifdef CRY12
	i = 2;
	j = 239;
	do
	{
		while (--j);
	} while (--i);
	#endif //CRY12
	
	#ifdef CRY110592
	_nop_();
	i = 2;
	j = 199;
	do
	{
		while (--j);
	} while (--i);
	#endif //CRY110592
}

void __delay1s() {
	unsigned char i, j, k;

	#ifdef CRY12
	_nop_();
	i = 8;
	j = 154;
	k = 122;
	do
	{
		do
		{
			while (--k);
		} while (--j);
	} while (--i);
	#endif //CRY12
	
	
	#ifdef CRY110592
	_nop_();
	i = 8;
	j = 1;
	k = 243;
	do
	{
		do
		{
			while (--k);
		} while (--j);
	} while (--i);
	#endif //CRY110592
}

void delay_us(unsigned char n) {
	while(n--) {
		__delay1us();	
	}
}


void delay_10us(unsigned char n){
	while(n--) {
		__delay10us();	
	}
}

void delay_100us(unsigned char n){
	while(n--) {
		__delay100us();	
	}
}

void delay_ms(unsigned long n) {
	while(n--) {
		__delay1ms();	
	}
}

void delay_ss(unsigned long n) {
	while(n--) {
		__delay1s();	
	}
}

/* END OF FILE */
